﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Engine.Dtd.Schema;

namespace Engine.Sgml {
    [DebuggerNonUserCode]
    static class Guard {
        public static void ArgumentNotNull(object argument, string name) {
            if (argument == null)
                throw new ArgumentNullException(name);
            }

        public static void ArgumentNotNullOrEmpty(string argument, string name) {
            if (string.IsNullOrEmpty(argument))
                throw new ArgumentNullException(name);
            }

        public static void ArgumentNotNullOrWhitespace(string argument, string name) {
            if (argument == null)
                throw new ArgumentNullException(name);
            if (string.IsNullOrWhiteSpace(argument))
                throw new ArgumentException("The argument cannot be empty or whitespace.", name);
            }

        public static void ArgumentNotNullOrEmpty(DModelGroups argument, string name) {
            if (argument == null)
                throw new ArgumentNullException(name);
            if (argument == DModelGroups.Empty || argument.Count == 0)
                throw new ArgumentException("The model groups cannot be empty.", name);
            }
        }
    }
